Integrating 3rd party imaging systems
It is possible to integrate the Multimedia repository with third party imaging systems. Instead of specifying a location as the value in a ServerMediaPath Registry entry, we use the exec
extension to specify a server-side program to be executed. For example:
System|Path|ServerMediaPath|exec imagehandler
indicates that a program called imagehandler
located on the EMu server is to be used to handle all multimedia requests. The program is required to handle five service types:
Arguments:
get
filepath
Failed return value:
Status: failed
Success return value:
Status: success
pathtofile
The get service is used to retrieve a file from a third party image store. The filepath argument is the generated directory component for the multimedia record's IRN with the filename appended. The filepath is the resource to be retrieved. To service this request the program must retrieve the resource from its storage area and copy it to a location in the Unix file system (normally /tmp). The full path to the temporary file must be supplied as the pathtofile return value. EMu will then copy the file onto the client machine and delete the temporary file from the server.
It is important to make sure a path to the original image is not passed back as EMu will try and remove it after copying the file to the client.
Arguments:
save
filepath tmppath
Failed return value:
Status: failed
Success return value:
Status: success
The save service is used to save a file to the third party image store. The filepath argument is the generated resource name consisting of the multimedia IRN and the filename. The tmppath argument is a path to the file to be saved. The tmppath file is stored on the EMu server (normally in /tmp). Once the image has been copied into the third party storage area, the tmppath file must be removed as EMu does not remove it after the save is complete.
Arguments:
list
folder
Failed return value:
Status: failed
Success return value:
Status: success
file1
file2
...
The list
service is used to list all files associated with a given multimedia record IRN. The folder argument is the generated path name for a given multimedia IRN. For example, IRN 12010 would give a folder of 12/010. It is necessary to build up a list of all the files associated with this folder (or IRN). The files are returned one per line in the data section of the return message.
Arguments:
ping
filepath
Failed return value:
Status: failed
Success return value:
Status: success
Last-modified:
unxitime
Content-Length:
filesizeinbytes
The ping
service is used to get the file size and modify time on a file. The filepath argument is the generated path to the file whose attributes are required. The returned unixtime is the time the file was last modified in seconds since 1 Jan 1970. The filesizeinbytes value is the size of the file in bytes.
Arguments:
remove
filepath
Failed return value:
Status: failed
Success return value:
Status: success
The remove
service is used to remove a file from a third party store. The filepath argument is the generated path to the file to be removed.
When the program is invoked on the server it is passed the service to be provided (namely get, save, list, ping or remove) as its first argument. The program is expected to pass back a status to indicate whether the operation was successful. The status is returned as the header information of the return text. An example return value is:
Status: success (header section)
/tmp/filename (data section)
Each return document consists of a header section and an optional data section.
Most services are called with a filepath as their argument. The filepath is the part of the directory path that is calculated from the multimedia record IRN with the filename appended. Thus if we have a file file.jpg that is associated with multimedia record IRN 12010, the filepath would be 12/010/file.jpg.